/* 全局样式 */
:root {
    --primary-color: #2E7D32;
    --secondary-color: #4CAF50;
    --accent-color: #81C784;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fafafa;
    margin: 0;
    padding: 0;
}

/* 主体内容容器 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 标题样式 */
h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 2rem;
    margin: 2rem 0;
    position: relative;
    padding-bottom: 1rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--secondary-color);
    border-radius: 2px;
}

/* 导航栏样式 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem;
    box-shadow: var(--shadow);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 2rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

#current-time {
    color: white;
    margin-left: 2rem;
}

/* 轮播图样式 */
.slider-container {
    position: relative;
    max-width: 1200px;
    margin: 3rem auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.slider {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    position: relative;
}

.slide::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
}

.slide img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.slide-content {
    position: absolute;
    bottom: 20%;
    left: 10%;
    color: white;
    z-index: 1;
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.slide-content p {
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.prev { left: 10px; }
.next { right: 10px; }

.prev:hover, .next:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

/* 分类导航样式 */
.quick-categories {
    padding: 2rem 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.category-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.category-item .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* 药材卡片样式 */
.herb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.herb-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid #eee;
}

.herb-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.herb-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.5s ease;
}

.herb-card:hover img {
    transform: scale(1.05);
}

.herb-card h3 {
    color: var(--primary-color);
    margin: 1rem 0;
    font-size: 1.4rem;
    text-align: center;
}

.herb-card p {
    color: #666;
    margin: 1rem 0;
    min-height: 3em;
}

.herb-card a {
    display: block;
    text-align: center;
    margin: 1rem auto;
    width: 80%;
    padding: 0.8rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: background-color 0.3s ease;
}

.herb-card a:hover {
    background-color: var(--primary-color);
}

.herb-tags {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
}

.herb-tags span {
    background: var(--accent-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* 更多页面特定样式 */
.more-page {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.categories {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 1rem;
}

.category-search {
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.category-search input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.category-search input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.categories ul {
    list-style: none;
    padding: 0;
}

.categories ul li {
    margin-bottom: 0.5rem;
}

.categories a {
    display: block;
    padding: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.categories a:hover {
    color: var(--primary-color);
}

.categories a.active {
    color: var(--primary-color);
    font-weight: bold;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
}

.herb-section {
    margin-bottom: 4rem;
}

.herb-section h2 {
    margin-bottom: 2rem;
}

.herbs-content {
    padding: 0 1rem;
}

/* 页脚样式 */
footer {
    background: #333;
    margin-top: 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 3rem 2rem;
    background: #222;
}

.footer-section h3 {
    color: white;
    margin-bottom: 1rem;
}

.footer-section p,
.footer-section a {
    color: #999;
    text-decoration: none;
    display: block;
    margin: 0.5rem 0;
}

.footer-section a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.footer-bottom {
    background: #111;
    padding: 1rem;
    text-align: center;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .more-page {
        grid-template-columns: 1fr;
        padding: 0 0.5rem;
    }

    .categories {
        position: static;
        margin-bottom: 2rem;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
    }

    .nav-links a {
        margin: 0.5rem 0;
    }

    .slide img {
        height: 300px;
    }

    .slide-content h2 {
        font-size: 1.8rem;
    }

    .slide-content p {
        font-size: 1rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .herb-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        padding: 1rem;
    }

    .category-search input {
        padding: 0.6rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    h2 {
        font-size: 1.6rem;
    }
}

/* 详情页样式 */
.detail-page {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.herb-detail {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.herb-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.image-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-gallery img:hover {
    transform: scale(1.05);
}

.info-section {
    margin-top: 1rem;
    line-height: 1.8;
}

/* 标签页样式 */
.herb-details-tabs {
    margin: 2rem 0;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light-gray);
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: bold;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 1rem 0;
}

.tab-content.active {
    display: block;
}

.usage-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.method-card {
    padding: 1.5rem;
    background: var(--light-gray);
    border-radius: 8px;
}

.precautions-list {
    list-style: none;
    padding: 0;
}

.precautions-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.precautions-list li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
}

.history-text {
    line-height: 1.8;
    text-indent: 2em;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .herb-detail {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
    }

    .usage-methods {
        grid-template-columns: 1fr;
    }
}

/* 评论区样式优化 */
.comments-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 3rem auto;
}

.comment-form {
    background: var(--light-gray);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.user-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.input-group {
    flex: 1;
}

#user-name {
    width: 200px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stars {
    display: flex;
    gap: 0.2rem;
}

.star {
    color: #ddd;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.star.active {
    color: #FFD700;
}

.star:hover {
    color: #FFD700;
}

.comment-form textarea {
    width: 100%;
    height: 100px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 0.5rem;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    color: #666;
    font-size: 0.9rem;
}

#submit-comment {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-comment:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.comment {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.comment:hover {
    transform: translateY(-2px);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-info {
    flex: 1;
}

.user-name {
    font-weight: bold;
    color: var(--primary-color);
}

.rating-display {
    color: #FFD700;
    font-size: 0.9rem;
}

.comment-time {
    color: #999;
    font-size: 0.9rem;
}

.comment-content {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.comment-actions {
    display: flex;
    gap: 1rem;
}

.like-btn, .reply-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    transition: all 0.3s ease;
}

.like-btn:hover, .reply-btn:hover {
    color: var(--primary-color);
}

.like-count {
    font-size: 0.9rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .comments-section {
        padding: 1rem;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-header {
        flex-wrap: wrap;
    }

    .comment-time {
        width: 100%;
        margin-top: 0.5rem;
    }
}